package com.zhanjixun.weixin.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import org.json.XML;

/**
 * 位置分享消息
 * <msg>
 * <location x="23.063653" y="113.213843" scale="15" label="广州市荣佳商场(荔湾区海南太村坊200号附近)" maptype="roadmap" poiname="荣佳商场(荔湾区海南太村坊200号附近)" poiid="City" />
 * </msg>
 *
 * @author :zhanjixun
 * @date : 2018/11/20 14:14
 */
@Data
public class LocationMsg {

    private Double x;
    private Double y;
    private Integer scale;
    private String label;
    private String mapType;
    private String poiName;
    private String poiId;

    public static LocationMsg valueOf(String oriContent) {
        return JSON.parseObject(XML.toJSONObject(oriContent)
                .getJSONObject("msg")
                .getJSONObject("location").toString(), LocationMsg.class);
    }
}
